#include <iostream>
#include <jsoncpp/json/json.h>
#include <unistd.h>

int main()
{
    Json::Value root;
    root["name"]="张三";
    root["age"]=30;
    root["isStudent"]=false;

    std::string jsonstring=root.toStyledString();

    // Json::StyledWriter w;
    // std::string jsonstring=w.write(root);

    std::cout<< jsonstring<<std::endl;

    Json::Reader reader;
    Json::Value result;
    reader.parse(jsonstring,result);

    std::string name=result["name"].asString();
    int age=result["name"].asInt();
    bool r=result["isStudent"].asBool();

    std::cout << "Name: " << name << std::endl;
    std::cout << "Age: " << age << std::endl;
    std::cout << "isstudent: " << r << std::endl;

    return 0;
}